package com.foreknow.demo9;

/**
 * @author shkstart
 * @create 2021-07-29 10:32
 */
public class ExceptionDemo2 {
   public int add(int a,int b) throws  Exception{
        if(a<0||b<0){
            Exception e=new Exception();
            throw e;
        }
        return a+b;
    }

    public static void main(String[] args) {
        ExceptionDemo2 demo2=new ExceptionDemo2();
        try {
            demo2.add(1,2);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
